package aspect;


import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class CheckByMD5{
	private final String pointcut1 = "execution(* service.PersonDaoManager.addPerson(..))";
	private final String pointcut2 = "execution(* service.PersonDaoManager.deletePerson(..))";
	private final String pointcut3 = "execution(* service.PersonDaoManager.findAllPerson(..))";
	private final String pointcut4 = "execution(* service.PersonDaoManager.updatePerson(..))";
//	public Object checkLogin(ProceedingJoinPoint pjd){
//		Object object =null;
//		Person person  = (Person) pjd.getArgs()[0];
//		person.setId(MD5Util.getMD5String(person.getId()));
//		try {
//			object = pjd.proceed(new Object[] {person});
//		} catch (Throwable e) {
//			e.printStackTrace();
//		}
//		return object;
//	}
	@After(pointcut1)
	public  void logAdd(){
		System.out.println("Regist one person");
	}
	
	@After(pointcut2)
	public  void logDelete(){
		System.out.println("delete one person");
	}
	
	@After(pointcut3)
	public  void logFindAll(){
		System.out.println("find all person");
	}
	
	@After(pointcut4)
	public  void logUpdate(){
		System.out.println("update one person");
	}
	
}
